Skip to content

[test-improver] Improve tests for launcher package#10089

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
test-improver/launcher-coverage-b455a38a6b9a05ef
Draft

[test-improver] Improve tests for launcher package#10089
github-actions[bot] wants to merge 1 commit into
mainfrom
test-improver/launcher-coverage-b455a38a6b9a05ef

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

Improved test coverage for internal/launcher package from 96.8% → 97.3%.

File Analyzed

internal/launcher/getorlaunchforsession_test.go and internal/launcher/launcher_runtime_test.go

Improvements Made

New tests in getorlaunchforsession_test.go

  • TestGetOrLaunchForSession_ServerNotFound — covers the ErrServerNotFound error path when an unknown server ID is requested
  • TestGetOrLaunchForSession_HTTPBackendRecordsStart — covers the HTTP backend path through GetOrLaunchForSessiongetOrLaunchWithConfigrecordStart, and verifies server state is marked as "running"
  • TestGetOrLaunchForSession_DoubleCheckLockPoolHit — exercises the session pool cache hit path where a pre-populated pool entry is returned without launching a new backend

Updated tests in launcher_runtime_test.go

  • nil config case added to TestIsDirectStdioCommand table — covers the if serverCfg == nil { return true } guard in isDirectStdioCommand
  • TestNew_RunningInContainer — covers the log.Println("[LAUNCHER] Detected running inside a container") branch in New() by setting RUNNING_IN_CONTAINER=true

Coverage Before/After

Function Before After
launcher.go: New 95.2% 100.0%
launcher.go: isDirectStdioCommand 92.9% 100.0%
Total 96.8% 97.3%

Test Output

ok  	github.com/github/gh-aw-mcpg/internal/launcher	16.620s	coverage: 97.3% of statements

All tests pass with -count=3 for stability verification.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • index.crates.io

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "index.crates.io"

See Network Configuration for more information.

Generated by Test Improver · sonnet46 · 118.3 AIC · ⊞ 5.8K ·

…ctStdioCommand

- Add TestGetOrLaunchForSession_ServerNotFound to cover ErrServerNotFound path
- Add TestGetOrLaunchForSession_HTTPBackendRecordsStart to cover HTTP backend
  recordStart path and verify server state tracking
- Add TestGetOrLaunchForSession_DoubleCheckLockPoolHit to exercise pool cache hit
- Add nil config case to TestIsDirectStdioCommand table
- Add TestNew_RunningInContainer to cover container detection log branch in New()

Coverage: internal/launcher 96.8% → 97.3%

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants